package com.itheima.day06;

import javax.imageio.stream.IIOByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Demo01 {

    public static void main(String[] args) {
        ArrayList<Integer> integers = new ArrayList<>();
        integers.add(26);
        integers.add(20);
        integers.add(19);
        integers.add(30);
        integers.add(28);
        integers.add(40);

        Collections.shuffle(integers);
        System.out.println(integers);

        Collections.sort(integers, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;

            }
        });
        System.out.println("降序"+integers);


        Collections.sort(integers, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1 - o2;
            }
        });

        System.out.println("升序"+ integers);




    }

}

